
import gevent.socket

import gproxy

HOST = 's2.app100652394.qqopenapp.com'
PORT = 8010
TGW_HEAD = 'tgw_l7_forward\r\nHost: %s:%d\r\n\r\n' % (HOST, PORT)

def new_tgw_conn():
	conn = gevent.socket.socket()
	conn.connect((HOST, PORT))
	conn.sendall(TGW_HEAD)
	return conn

def worker():
    conn = new_tgw_conn()
    gproxy.handler(conn, None)

lets = []
for i in xrange(10):
    lets.append(gevent.spawn(worker))

gevent.joinall(lets)


